Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bin/xbps-install: add --import-key arg for non-interactive key import #568

Closed

Conversation

classabbyamp
Copy link
Member

@classabbyamp classabbyamp commented Aug 11, 2023

as requested by @the-maldridge

see also: #336, #399

This works around the security concerns brought up in those issues by ensuring that only the requested keys are ever imported automatically, not blindly importing any keys that would be prompted for importation.

  • lib/repo.c: add expected fingerprints argument to xbps_repo_key_import

This array is a list of key fingerprints that should be imported without confirmation upon importing keys for a signed repository. A new state_cb state is added to allow for showing a message or doing some action when importing these keys.

  • bin/xbps-install: add --import-key arg for non-interactive key import

Allows the user to specify a list of key fingerprints that are expected and should be imported if encountered. This will be useful for scripted or other non-interactive situations, including in xbps-src (removing interaction during operations if the repodata in hostdir/binpkgs is signed), and bootstrapping new systems without needing to copy the <fingerprint>.plist files into place beforehand.

Prints a message when importing to ensure the user knows the key was imported:

# xbps-install -k '6e:a5:91:cc:71:99:18:32:75:dc:be:b4:f8:ac:dc:19' -R http://localhost:8000/ -R https://repo-fastly.voidlinux.org/current -r /tmp/xbps-test -S
[*] Updating repository `http://localhost:8000//x86_64-repodata' ...
x86_64-repodata: 2098B [avg rate: 500MB/s]
[*] Updating repository `https://repo-fastly.voidlinux.org/current/x86_64-repodata' ...
x86_64-repodata: 1849KB [avg rate: 597MB/s]
`http://localhost:8000/' repository has been RSA signed by "classabbyamp"
Importing key with fingerprint: 6e:a5:91:cc:71:99:18:32:75:dc:be:b4:f8:ac:dc:19
`https://repo-fastly.voidlinux.org/current' repository has been RSA signed by "Void Linux"
Fingerprint: 60:ae:0c:d6:f0:95:17:80:bc:93:46:7a:89:af:a3:2d
Do you want to import this public key? [Y/n]

this array is a list of key fingerprints that should be imported without
confirmation upon importing keys for a signed repository. A new state_cb
state is added to allow for showing a message or doing some action when
importing these keys.
Allows the user to specify a list of key fingerprints that are expected
and should be imported if encountered. This will be useful for scripted
or other non-interactive situations, including in xbps-src (removing
interaction during operations if the repodata in hostdir/binpkgs is signed),
and bootstrapping new systems without needing to copy the <fingerprint>.plist
files into place beforehand.

Prints a message when importing to ensure the user knows the key was imported:

```
[*] Updating repository `http://localhost:8000//x86_64-repodata' ...
x86_64-repodata: 2098B [avg rate: 500MB/s]
[*] Updating repository `https://repo-fastly.voidlinux.org/current/x86_64-repodata' ...
x86_64-repodata: 1849KB [avg rate: 597MB/s]
`http://localhost:8000/' repository has been RSA signed by "classabbyamp"
Importing key with fingerprint: 6e:a5:91:cc:71:99:18:32:75:dc:be:b4:f8:ac:dc:19
`https://repo-fastly.voidlinux.org/current' repository has been RSA signed by "Void Linux"
Fingerprint: 60:ae:0c:d6:f0:95:17:80:bc:93:46:7a:89:af:a3:2d
Do you want to import this public key? [Y/n]
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant